"""
检查数据库中的用户
"""
import sys
import os

# 添加项目根目录到Python路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

from app.core.database import SessionLocal
from app.models.user import User

def check_users():
    """检查用户"""
    db = SessionLocal()
    try:
        users = db.query(User).all()
        print(f'用户数量: {len(users)}')
        for user in users:
            print(f'邮箱: {user.email}, 用户名: {user.username}, 超级用户: {user.is_superuser}')
    except Exception as e:
        print(f"查询用户失败: {str(e)}")
    finally:
        db.close()

if __name__ == "__main__":
    check_users()